import 'package:cloud_music/ui/shared/text_styles.dart';
import 'package:cloud_music/ui/widgets/v_empty_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class NetErrorWidget extends StatelessWidget {
  final VoidCallback callback;
  final String text;
  NetErrorWidget({@required this.callback, this.text});
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: callback != null ? callback : () {},
      child: Container(
        alignment: Alignment.center,
        height: ScreenUtil().setWidth(200),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Icon(
              Icons.error_outline,
              size: ScreenUtil().setWidth(80),
            ),
            VEmptyView(10),
            Text(
              text.isEmpty ? '重新加载' : text,
              style: commonTextStyle,
            )
          ],
        ),
      ),
    );
  }
}
